package com.itmeima.d3_util;

import java.util.Random;

public class MyUtil {
    private MyUtil(){}
    //随机生成验证码
    public static String createCode(int n){
        String code ="";
        String chars ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

        Random random = new Random();
        for (int i = 0; i < n; i++) {
            int index = random.nextInt(chars.length());
            code += chars.charAt(index);
        }
        return code;
        }
    }

